//
//  TraceNodeTests.m
//  UnitTests
//
//  Created by Jiang on 2018/10/23.
//  Copyright © 2018 jiang. All rights reserved.
//

#import <XCTest/XCTest.h>

@interface TraceNodeTests : XCTestCase

@end

@implementation TraceNodeTests

- (void)testTraceNodeBackdate{
    id <Talk>talk1 = [[NormalTalk alloc] initWitContent:@"content 10min"];
    id <Talk>talk2 = [[NormalTalk alloc] initWitContent:@"content 20min"];
    id <Talk>talk3 = [[NormalTalk alloc] initWitContent:@"content 30min"];
    id <Talk>talk4 = [[NormalTalk alloc] initWitContent:@"content 40min"];
    
    TraceNode *node1 = [[TraceNode alloc] initWithTalk:talk1 lastNode:nil];
    TraceNode *node2 = [[TraceNode alloc] initWithTalk:talk2 lastNode:node1];
    TraceNode *node3 = [[TraceNode alloc] initWithTalk:talk3 lastNode:node2];
    TraceNode *node4 = [[TraceNode alloc] initWithTalk:talk4 lastNode:node3];
    TraceNode *tmp = node4;
    int index = 4;
    while (tmp) {
        int value = index * 10;
        XCTAssertEqual(tmp.currentTalk.duration, value);
        tmp = tmp->_lastNode;
        index = index - 1;
    }
}

@end
